#!/usr/bin/python
# -*- coding: UTF-8 -*-

from kpautos.engine.case import Case
from kptest.config.enum import DeviceType, HostType, DeviceUtility


class BMC_SSH_05(Case):
    """
        Name:
            BMC_SSH_05
        Label:
            下载黑盒数据
        PreCondition:
            1) BMC正常运行
        TestStep:
            1) 执行ipmcget -d blackbox，判断命令执行是否成功，有结果A）
        ExpectedResult:
            A) 命令执行成功
        Parameters:

        Author:
            KT2001284
        Last Modified:
            2025-10-30
        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        self.logger.info("Pre Test Case Start.... ")
        self.device_dut = self.resource.get_device(device_type=DeviceType.Server, utility=DeviceUtility.DUT)
        self.bmc_cli_api = self.device_dut.get_api(ns_name="BmcCli")

    # 测试步骤
    def procedure(self):
        self.log_step("Step1: 下载黑盒数据")
        result = self.bmc_cli_api.cli_download_black_box_file()
        if result == None:
            raise Exception("下载黑盒数据失败")
        self.logger.info(f"下载黑盒数据命令的返回值为：{result}")

    # 测试结束后恢复环境
    def post_test_case(self):
        pass